/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cardamy.lib.deck;
import org.cardamy.core.deck.DeckBuilder;
import org.cardamy.core.deck.Deck;
import org.cardamy.core.card.attr.CardAttribute;
import org.cardamy.core.card.attr.CardAttributeHolder;
import org.cardamy.core.card.Card;
import org.cardamy.lib.card.attr.FrenchSuitCardAttribute;
import org.cardamy.lib.card.attr.FrenchSuitCardAttribute.Suit;
/**
 *
 * @author Santiago
 */
public class FrenchDeckBuilder extends DeckBuilder {
    
    protected int[] _rank    = {1,2,3,4,5,6,7,8,9,10,11,12,13};
    protected Suit[] _suits  = FrenchSuitCardAttribute.Suit.values();
    protected String[] _enum = "A,2,3,4,5,6,7,8,9,10,J,Q,K".split(",");
    public FrenchDeckBuilder() {
    }
    
    @Override
    public Deck create() {
        int totalCards = _rank.length;
        Deck deck = new Deck();
        
        for(Suit suit : _suits) {
            for ( int i = 0; i < totalCards; i++ ) {

                CardAttributeHolder attr = new CardAttributeHolder();
                attr.addAttr(new CardAttribute("Enum", _enum[i]))
                        .addAttr(new CardAttribute(
                            "Rank", String.valueOf(_rank[i])
                        ))
                        .addAttr(new FrenchSuitCardAttribute("Suit", suit));
                deck.addCard(new Card(attr));
            }
        }
        return deck;
    }
   
}
